home *** CD-ROM | disk | FTP | other *** search
- property startH, maxV, endH, minV, increment, gasLevel, currentV, channel, shape, firstTime
- global gMenuObject
-
- on birth me
- set firstTime to 1
- set channel to 24
- set shape to the number of cast "gasIndicator"
- return me
- end
-
- on initGasGauge me
- if firstTime then
- set spriteRect to the rect of sprite channel
- set startH to getAt(spriteRect, 1)
- set maxV to getAt(spriteRect, 2)
- set endH to getAt(spriteRect, 3)
- set minV to getAt(spriteRect, 4)
- set currentV to maxV
- set firstTime to 0
- end if
- end
-
- on resetGasGauge me, howManyMoves
- set maxValue to howManyMoves + integer(howManyMoves * 0.25)
- set increment to 1.0 * (minV - maxV) / maxValue
- set gasLevel to maxValue
- set currentV to maxV
- end
-
- on fixGasChannel me
- set the stretch of sprite channel to 0
- set the type of sprite channel to 1
- set the foreColor of sprite channel to 255
- end
-
- on reduceGasGauge me
- set gasLevel to gasLevel - 1
- if gasLevel > 0 then
- set currentV to currentV + increment
- else
- set currentV to minV
- end if
- end
-
- on predrawGasGauge me
- set the castNum of sprite channel to shape
- set the rect of sprite channel to rect(startH, currentV, endH, minV)
- set the foreColor of sprite channel to 185
- puppetSprite(channel, 1)
- end
-
- on updateGasGauge me
- set the rect of sprite channel to rect(startH, currentV, endH, minV)
- end
-
- on saveGasGauge me
- set gasData to EMPTY
- repeat with data in [startH, maxV, endH, minV, increment, gasLevel, currentV]
- set gasData to gasData & string(data) & ","
- end repeat
- return gasData
- end
-
- on loadGasGauge me, index
- set startH to value(item index of the dataString of gMenuObject)
- set index to index + 1
- set maxV to value(item index of the dataString of gMenuObject)
- set index to index + 1
- set endH to value(item index of the dataString of gMenuObject)
- set index to index + 1
- set minV to value(item index of the dataString of gMenuObject)
- set index to index + 1
- set increment to value(item index of the dataString of gMenuObject)
- set index to index + 1
- set gasLevel to value(item index of the dataString of gMenuObject)
- set index to index + 1
- set currentV to value(item index of the dataString of gMenuObject)
- set index to index + 1
- return index
- end
-